<template>
	<view class="privacy">
		<view class="content">
			<view class="item">
				<view class="left">
					<view class="title">我拥有的 仅自己可见</view>
				</view>
				<u-switch v-model="haveSwitch" activeColor="#000" @change="changeHave"></u-switch>
				<!-- <u-icon name="arrow-right" color="#BBBBBB"></u-icon> -->
			</view>
			<!-- <view class="item">
				<view class="left">
					<view class="title">我卖出的 仅自己可见</view>
				</view>
				<u-switch v-model="sellOutSwitch" activeColor="#000"></u-switch>
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				haveSwitch: false
			}
		},
		mounted() {
			// this.haveSwitch = uni.getStorageSync('haveSwitch')
		},
		methods: {
			async changeHave (e) {
				// console.log(Number(e));
				const res = await this.$http({
					url: this.$api.setPrivateMode,
					method: 'POST',
					hideLoading: true,
					data: {
						mode: Number(e)
					}
				})
				if (res.code !== 200) {
					this.haveSwitch = !e
					this.$u.toast(res.msg);
				} else {
					this.haveSwitch = e
				}
			}
		}
	}
</script>

<style scoped lang="scss">
.privacy {
	// min-height: 100vh;
	padding: 30rpx;
	box-sizing: border-box;
	background-color: $nft-bg-color;
	border-top: #F5F5F5 2rpx solid;
	.content {
		.item {
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 28rpx;
			font-weight: 600;
			color: #131415;
			padding: 34rpx 0 34rpx 0;
			border-bottom: 1px solid #F5F5F5;
			.left {
				display: flex;
				align-items: center;
		
				image {
					width: 32rpx;
					height: 36rpx;
					margin-right: 44rpx;
				}
			}
		}
	}
}
</style>
